The miracle of QEMU, at least to me

| 4 min read

One of the fascinating things about computer hardware is of course the software we can run on the hardware. Some people only know computers as keyboards and screens that they use to type some daily work, not giving it much thought. Others at a slightly higher level might care about whether they are using Windows or Mac, simply because they get used to one or the other, and cannot easily switch between the two. Past this, at the level of computer users more comfortable with them, are the people that might use Linux to browse the Internet, or adjust a PostgreSQL database schema, or run a neural network simulation on some data to teach the computer to spot the difference between an image of a blue frog from a yellow bird. At most of the stages the hardware is all appreciably the same. Chip manufacturing since the 1980s has been more of a race of shrinkage than one of many competing architectures, and when architectures did differ, the software layed on top was often the same, that is, it ran Windows, Mac or some flavour of Linux.

So now we have super computers in our watches, and a modestly priced Raspberry Pi is more powerful than the entire Bitcoin algorithm. I invested in a i7 iMac with a 5K screen and 64GB RAM five years ago as my development machine. Today it is still a workhouse, and if I replace the SSD with a larger, faster model, the computer should last another 5 years. But boredom with MacOS led me to try out M1 in a Mac Mini. Unfortunately, networking the mini into my flow is painfully slow, and there is no point in trying to use an M1 mini as a remote networked machine. It needs a screen and keyboard to be truly appreciated. That got me thinking though, about virtualization and emulation and running one computer from another. I SSH into a Raspberry Pi in my garage workshop that is running Octoprint, so I can monitor and control my 3D printer without having to chug up and down the stairs, from my home office. It is almost instant on, and I have full control of the awesomeness of the Pi, but only because I am using a shell and terminal, not an entire GUI OS.

So I discover QEMU as a thing and never bother to figure it out. Whenever I am faced with having to work from a consistent software experience, all the typical energy there is expended in Docker. Kubernetes is for masochists with time on their hands. Docker is neat, but the constant churn I see in maintaining Docker itself is a bit of a turnoff. Not a day goes by when I am seeing the whale offer me a new update. The docker containers are not changing, but Docker itself is. Constantly.

So what about QEMU? I was using Virtual Box to try out Linux on Mac, and that was straight up a terrible experience. Nothing was nice about it. From the full manual downloading of iso files, to the partitions, to the fact the display looked like garbage, I was once again relieved to see how Linux on the Desktop was still full on hacker level fun. I had Parallels for my Mac when I had to pretend to service the one or two people that would approach me with a Windows only problem, and if I am honest, it was only so I could run whatever that Microsoft browser used to be, before they capitulated to Chrome by default as their browser. IE? I don't remember.

But never did I spring for VMWare. Paying for virtualization seemed like too much work, when I had it for free with Virtual Box. I had no idea that QEMU was actually the way to go. So I installed it, and found a guy that has released a patchset to QEMU that runs OpenGL in full 5K on a MacOS host. So I grabbed PopOS as a test, and organized two small shell scripts to 1) install PopOS and then 2) run/boot into PopOS. It worked pretty much as advertised right out of the box. Without me doing much at all, I have a MacOS desktop workspace running PopOS. I can three finger swipe through my MacOS screens, and end up in PopOS as one of them. My mouse, keyboard and network all work fine in this environment, and the screen is fully 5K Retina. That is awesome. So now I have the full Linux desktop experience via PopOS running in a window the same as VSCode or iTerm, or Firefox.

The neat thing is the QEMU does not consume resources unless I instruct it to do something, in which case, the entire Mac is subject to sharing. That is totally acceptable to me. It is so nice to be able to do this. I can see trying many different *nix flavours with this QEMU. While not quite as specific as Docker is to programming, this does offer the neat option of spending time configuring, customizing, and tricking out a state of the art OS while maintaining continuity with a 5 year old workstation. I can see updating my SSD and copying these files on the new one, and instantly being right back where I was before, but with a few TB of faster storage at my disposal. I can bet the people selling computers hate this, as they always want you to buy the latest shiny new toys, but in the current incarnation, I am quite happy to try and eke another five years out of this machine, as it is plenty for me, and I have access to all the latest stuff without struggling, thanks to amazing tools like QEMU!

The OpenGL implementation to play with: QEMU OpenGL